<?php
 class Customers extends CI_Model{
    
    function __construct(){
        parent::__construct();
    }
    
    /**
     * Get list product index
     * @author tien.nguyen
     * @return array
     */
    public function getListIndex(){
       $this->db->where('Visible', 1);
       $this->db->limit(3);
       $this->db->order_by('CreatedDate', 'DESC');
       $query = $this->db->get('customers');
        
       return $query->result_array(); 
    }
    
     /**
     * Get list product index
     * @author tien.nguyen
     * @return array
     */
    public function getListCustomer($page = 1){
       $this->db->where('Visible', 1);
       $this->db->limit(10, ($page -1) *10);
       $this->db->order_by('CustomerName', 'ASC');
       $query = $this->db->get('customers');
        
       return $query->result_array(); 
    }
    
      /**
     * Get news by new id 
     * @author tien.nguyen
     * @return array
     */
    public function getCustomer($customerId){
       $query = $this->db->get_where('customers', array('CustomerId' => $customerId)); 
       return $query->row_array(); 
    }
 }
?>